#include "StdAfx.h"
#include "PCase.h"
#include "..\MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif

#pragma warning(disable:4996)

CPCase::CPCase(void)
{

}

CPCase::~CPCase(void)
{
}

CPCase * CPCase::GetActiveCase()
{
	CPCase * pCurrentCase=0;
	CPCase * pChildCase=0;
	std::vector<CPEntry *> vecChildren = this->GetChildSet();
	for (std::vector<CPEntry*>::iterator it = vecChildren.begin(); it < vecChildren.end(); it++)
	{
		pChildCase = dynamic_cast<CPCase *>(*it);

		if(pChildCase->GetCaseStatement())
		{
			pCurrentCase=pChildCase;
			break;
		}
		pCurrentCase=pChildCase->GetActiveCase();

	}
	return pCurrentCase;

}
